<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    .H{
      color: palevioletred;
    }
    button{
      width: 100px;
      text-align: center;  
    }

  </style>
</head>
<!-- 3. 切换支付方式效果 -->
<body>
  <div id="app">

    <button @click="activeIndex=0" :class="{'H':activeIndex===0}">银联</button>
    <button @click="activeIndex=1" :class="{'H':activeIndex===1}">支付宝</button>
    <button @click="activeIndex=2" :class="{'H':activeIndex===2}">微信</button>

  </div>
</body>
<script src="./vue.js"></script>
<script>
  const { createApp ,ref} = Vue;
  createApp({
    setup () {
      let red = ref('H')
      let activeIndex = ref(2)
      return {
        red,
        activeIndex
      }
    }
  }).mount('#app')
</script>
</html>